/* *****************************************************************************
 * JFab (http://code.google.com/p/jfab)
 * Copyright (c) 2011 JFab.org
 * Admin jfab@jeffreythompson.net
 *
 * See the file "LICENSE.txt" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * *****************************************************************************/


package org.jfab.core.factory;

import org.javaruntype.type.Type;


/**
 * Defines methods required by an instance factory.
 */
public interface InstanceFactory
{
    /**
     * @param   <T>   Type.
     * @param   type  Type.
     *
     * @return  a new instance of the given class.
     *
     * @throws  InstanceCreationException  if there is any problem.
     */
    <T> T createInstance(Type<T> type);

    /**
     * @param   <T>   Type.
     * @param   type  Type.
     *
     * @return  a new instance of the given type.
     *
     * @throws  InstanceCreationException  if there is any problem.
     */
    <T> T createInstancePopulated(Type<T> type);
}
